<?php

namespace App\Http\Controllers\Test;

use App\Http\Controllers\Controller;
use App\Models\Category;
use Dingo\Api\Http\Response;

class TestController extends Controller
{

    /**
     * apidoc测试
     *
     * 使用 `username` 和 `password` 注册用户。
     *
     * @Post("/")
     * @Versions({"v1"})
     * @Request({"username": "foo", "password": "bar"})
     * @Response(200, body={"id": 10, "username": "foo"})
     */
    public function test()
    {
        return new Response('Laravel学院,优质Laravel中文学习资源平台');
    }

    public function test1()
    {
        $tree = Category::defaultOrder()
            ->get()
            ->toTree()
            ->toArray();
        return $tree;
//        return $this->response->array($tree);
    }
}
